﻿#include <stdio.h>

//快速将⼀个整形划分为IP地址的点分⼗进制形式

union IP
{
	int u_value;
	struct{
		unsigned char u_ip1;
		unsigned char u_ip2;
		unsigned char u_ip3;
		unsigned char u_ip4;
	};
};

int main(){
	union IP ip;
	printf("input value :>");
	scanf("%u", &ip.u_value);
	printf("%u.%u.%u.%u\n", ip.u_ip1, ip.u_ip2, ip.u_ip3, ip.u_ip4);

	//scanf("%u.%u.%u.%u", &ip.u_ip1, &ip.u_ip2, &ip.u_ip3, &ip.u_ip4);
	//printf("%u\n", ip.u_value);

	return 0;
}

/*
struct Test
{
char a;
double b;
int c;
};

int main(){
printf("size = %d\n", sizeof(struct Test));
return 0;
}

/*
//联合体/共用体
union Test
{
	char a;
	double b;
	int c;
};

int main(){
	printf("size = %d\n", sizeof(union Test));
	return 0;
}

/*
struct Test
{
	char a;
	double b;
	int c;
};

int main(){
	printf("size = %d\n", sizeof(struct Test));
	return 0;
}
*/